//
//  UIScreen+Extension.swift
//  DoctorEPlus
//
//  Created by 王林波 on 2020/10/27.
//

import Foundation
import UIKit

extension UIScreen {
    static var width: CGFloat {
        get {
            return UIScreen.main.bounds.size.width
        }
    }
    static var height: CGFloat {
        get {
            return UIScreen.main.bounds.size.height
        }
    }
    
    static var isXScreen: Bool {
        guard #available(iOS 11.0, *) else {
            return false
        }
        return UIApplication.shared.windows[0].safeAreaInsets.bottom > 0
    }
    
    static var scaleRadius: CGFloat {
        get {
            return UIScreen.width / 375.0
        }
    }
    
    static var begainY: CGFloat {
        get {
            return UIScreen.isXScreen ? 88 : 64
        }
    }
    
    static var stateBarHeight: CGFloat {
        get {
            return UIScreen.isXScreen ? 44 : 20
        }
    }
    
    static var safeBottomHeight: CGFloat {
        get {
            return UIScreen.isXScreen ? 34.0 : 0
        }
    }
    
    static var showHeight: CGFloat {
        get {
            return UIScreen.height-UIScreen.begainY
        }
    }
}
